<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <body>
        <ui:composition template="./../../WEB-INF/templates/noFooterTemplate.xhtml">
            <ui:define name="content">
                <h:form id="preferencesForm" styleClass="whiteForm" enctype="multipart/form-data">
                    <p:growl id="preferencesGrowl" showDetail="false" life="4000"/>
                         <p:panel header="#{messages.Preferences}" styleClass="noBorder noPaddingTitle" id="preferencesPanel">  
                             <h:panelGrid styleClass="marginBottom20" columns="2" >  
                                 <h:outputLabel for="selectLanguage" styleClass="marginRight20" value="#{messages.Language}" />
                                 <p:selectOneMenu filter="true" filterMatchMode="contains" required="true" converter="#{languageConverter}"  id="selectLanguage"  value="#{preferencesPublicRelationsBean.languageCollector}" effect="fade"  label="#{messages.Language}" requiredMessage="#{messages.LanguageRequired}">  
                                     <f:selectItems value="#{userResourcesBean.languages}" var="language" itemLabel="#{languageBundle[language.idLanguage.toString()]}" itemValue="#{language}"/>  
                                </p:selectOneMenu>
                             </h:panelGrid>
                             <p:commandButton update=":preferencesForm:preferencesGrowl" styleClass="updatePicturesButton personalBackgroundButton" value="#{messages.Edit}" action="#{preferencesPublicRelationsBean.save()}"  /> 
                         </p:panel>
                </h:form>
                <h:form id="preferencesPaswordForm" styleClass="whiteForm" enctype="multipart/form-data">
                         <p:panel header="#{messages.ChangePassword}" styleClass="noBorder noPaddingTitle" id="preferencesPasswordPanel">  
                             <h:panelGrid styleClass="marginBottom20" columns="2" >  
                                 <h:outputLabel for="passwordOld" styleClass="marginRight20" value="#{messages.OldPassword}" />
                                 <p:password styleClass="ui-inputtext" id="passwordOld" required="true" requiredMessage="#{messages.PasswordRequired}" label="#{messages.Password}">
                                    <f:attribute name="idUser" value="#{preferencesPublicRelationsBean.publicRelations.user.idUser}" />
                                    <f:validator  binding="#{passwordValidator}"></f:validator>
                                 </p:password>
                                 <h:outputLabel for="password" styleClass="marginRight20" value="#{messages.NewPassword}" />
                                 <p:password styleClass="ui-inputtext" id="password" match="password2" feedback="true" value="#{preferencesPublicRelationsBean.publicRelations.user.password}" required="true" requiredMessage="#{messages.PasswordRequired}" label="#{messages.Password}" validatorMessage="#{messages.PasswordNoMatch}">
                                    <f:validateLength minimum="5" maximum="30"></f:validateLength>
                                </p:password>
                                <h:outputLabel for="password2" styleClass="marginRight20" value="#{messages.RepeatNewPassword}" />
                                <p:password id="password2" styleClass="ui-inputtext" feedback="true" value="#{preferencesPublicRelationsBean.publicRelations.user.password}" required="true" requiredMessage="#{messages.RepeatPasswordRequired}" label="#{messages.RepeatPassword}">
                                </p:password>
                             </h:panelGrid>
                             <p:commandButton update=":preferencesForm:preferencesGrowl :preferencesPaswordForm:preferencesPasswordPanel" styleClass="updatePicturesButton interestBackgroundButton" value="#{messages.Edit}" actionListener="#{preferencesPublicRelationsBean.changePassword()}"  /> 
                         </p:panel>
                </h:form>    
            </ui:define>
        </ui:composition>
    </body>
</html>
